/*
|-----------------------------------------------------------------------------|
| Overall ANTLR Grammar File Structure                                        |
|-----------------------------------------------------------------------------|
| «grammarType» grammar name;
|   «optionsSpec»     = options { ... }
|   «tokensSpec»      = tokens { ... }
|   «attributeScopes» = «@action-scope-name::action-name» { ... }
|   «actions»
|   // rules
|   rule1 : ... ;
|   rule2 : ... ;
|   ...
|_____________________________________________________________________________|
|   «grammarType»         = ( lexer | parser | tree | <empty> )
|   «optionsSpec»         = options { ... }
|   «tokensSpec»          = tokens { ... }
|   «attributeScopes»     = 
|   «actions»             = @«action-scope-name»::«action-name» { ... }
|    «action-scope-name» = ( lexer | parser | tree | <empty> = parser )
|    «action-name»       = ( header | members | rulecatch | synpredgate )
|-----------------------------------------------------------------------------|
*/
parser grammar XMLParser;

	options {
	  language = Java;
	  output = AST;
	  tokenVocab = XMLLexer;
	}// options

  @parser::header {
    package pl.p06.antlr3;
  }//header
  @parser::members {
  }// members

//= Grammar Rules XML ========================================================|
// Referencia: http://www.antlr.org/wiki/display/ANTLR3/2.+Parser
document
  : element
  ;
 
	element
	  : startTag
	      ( element | PCDATA )*
	    endTag
	  ;
	
		startTag returns [String tagId]
		  : TagStartOpen Identifier (attribute)* TagClose
		  ;
	
			attribute
			  : Identifier AttributeAssing AttributeValue
			  ;
	 
		endTag
		  :  TagEndOpen Identifier TagClose
		  ;

/*
startTagExplicit
  : InitLibrary (attribute)* TagClose
  | InitBook (attribute)* TagClose
  | InitTitle (attribute)* TagClose
  | InitAuthor (attribute)* TagClose
  | InitEditorial (attribute)* TagClose
  ;
  
endTagExplicit
  : EndLibrary TagClose
  | EndBook TagClose
  | EndTitle TagClose
  | EndAuthor TagClose
  | EndEditorial TagClose
  ;
*/